workspace "MyDataStructure"
	architecture "x64"
	startproject "Examples"

	configurations
	{
		"Debug",
		"Release",
		"Dist"
	}

outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"

IncludeDir = {}
IncludeDir["gtest"] = "Tests/vendor/gtest"

include "Tests/vendor/gtest"

project "DataStructures"
	location "DataStructures"
	kind "SharedLib"
	language "C++"
	staticruntime "off"

	targetdir ("bin/" .. outputdir .. "/%{prj.name}")
	objdir ("bin-int/" .. outputdir .. "/%{prj.name}")

	files
	{
		"%{prj.name}/src/**.h",
		"%{prj.name}/src/**.cpp"
	}

	includedirs
	{
		"%{prj.name}/src"
	}

	defines
	{
		"DS_CORE"
	}

	filter "system:windows"
		cppdialect "C++17"
		systemversion "latest"

		postbuildcommands
		{
			("{COPY} %{cfg.buildtarget.relpath} \"../bin/" .. outputdir .. "/Examples/\""),
			("{COPY} %{cfg.buildtarget.relpath} \"../bin/" .. outputdir .. "/Tests/\"")
		}

	filter "configurations:Debug"
		defines "DS_DEBUG"
		runtime "Debug"
		symbols "On"

	filter "configurations:Release"
		defines "DS_RELEASE"
		runtime "Release"
		optimize "On"
	
	filter "configurations:Dist"
		defines "DS_DIST"
		runtime "Release"
		optimize "On"

project "Examples"
	location "Examples"
	kind "ConsoleApp"
	language "C++"
	staticruntime "off"

	targetdir ("bin/" .. outputdir .. "/%{prj.name}")
	objdir ("bin-int/" .. outputdir .. "/%{prj.name}")

	files
	{
		"%{prj.name}/src/**.h",
		"%{prj.name}/src/**.cpp"
	}

	includedirs
	{
		"DataStructures/src",
		"Examples/src"
	}

	links
	{
		"DataStructures"
	}

	filter "system:windows"
		cppdialect "C++17"
		systemversion "latest"

		defines
		{
			"DS_PLATFORM_WINDOWS"
		}

	filter "configurations:Debug"
		defines "DS_DEBUG"
		runtime "Debug"
		symbols "On"

	filter "configurations:Release"
		defines "DS_RELEASE"
		runtime "Release"
		optimize "On"
	
	filter "configurations:Dist"
		defines "DS_DIST"
		runtime "Release"
		optimize "On"
	

project "Tests"
	location "Tests"
	language "C++"
	kind "ConsoleApp"
	language "C++"
	staticruntime "off"

	targetdir ("bin/" .. outputdir .. "/%{prj.name}")
	objdir ("bin-int/" .. outputdir .. "/%{prj.name}")

	files
	{
		"%{prj.name}/src/**.h",
		"%{prj.name}/src/**.cpp"
	}

	includedirs
	{
		"%{prj.name}/src",
		"DataStructures/src",
		"Tests/vendor/gtest/googletest/include"
	}

	links
	{
		"DataStructures",
		"gtest"
	}

	filter "system:windows"
		cppdialect "C++17"
		systemversion "latest"
		defines
		{
			"DS_PLATFORM_WINDOWS"
		}

	filter "configurations:Debug"
		runtime "Debug"
		symbols "On"
		buildoptions "/MTd"

	filter "configurations:Release"
		runtime "Release"
		optimize "On"
	
	filter "configurations:Dist"
		runtime "Release"
		optimize "On"